package io.wdb.wxapp.model;

import java.io.Serializable;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;

import io.swagger.annotations.ApiModelProperty;

import io.wdb.modules.activity.wxapp.entity.HdUserEntity;


/**
 * 微信用户信息
 * 
 * @author wdb
 * @email xulin@wdb007.com
 * @date 2018-01-20 15:11:02
 */
public class HdUserModel implements Serializable {
	private static final long serialVersionUID = 1L;
	
	private String hdUserId;
	@ApiModelProperty(value = "手机号", required = true)
	private String mobile;
	@ApiModelProperty(value = "昵称", required = true)
	private String nickname;
	@ApiModelProperty(value = "头像", required = true)
	private String avatar;
	@ApiModelProperty(value = "小程序id", required = true)
	private String wxAppid;
	@ApiModelProperty(value = "openid", required = true)
	private String wxOpenid;
	private Integer totalRead;
	private Integer weekRead;
	private Integer monthRead;
	private Date createTime;

	/**
	 * 设置：
	 */
	public void setHdUserId(String hdUserId) {
		this.hdUserId = hdUserId;
	}
	/**
	 * 获取：
	 */
	public String getHdUserId() {
		return hdUserId;
	}
	/**
	 * 设置：手机号
	 */
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	/**
	 * 获取：手机号
	 */
	public String getMobile() {
		return mobile;
	}
	/**
	 * 设置：昵称
	 */
	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	/**
	 * 获取：昵称
	 */
	public String getNickname() {
		return nickname;
	}
	/**
	 * 设置：头像
	 */
	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}
	/**
	 * 获取：头像
	 */
	public String getAvatar() {
		return avatar;
	}
	/**
	 * 设置：小程序id
	 */
	public void setWxAppid(String wxAppid) {
		this.wxAppid = wxAppid;
	}
	/**
	 * 获取：小程序id
	 */
	public String getWxAppid() {
		return wxAppid;
	}
	/**
	 * 设置：openid
	 */
	public void setWxOpenid(String wxOpenid) {
		this.wxOpenid = wxOpenid;
	}
	/**
	 * 获取：openid
	 */
	public String getWxOpenid() {
		return wxOpenid;
	}
	/**
	 * 设置：总览
	 */
	public void setTotalRead(Integer totalRead) {
		this.totalRead = totalRead;
	}
	/**
	 * 获取：总览
	 */
	public Integer getTotalRead() {
		return totalRead;
	}
	/**
	 * 设置：周览
	 */
	public void setWeekRead(Integer weekRead) {
		this.weekRead = weekRead;
	}
	/**
	 * 获取：周览
	 */
	public Integer getWeekRead() {
		return weekRead;
	}
	/**
	 * 设置：月览
	 */
	public void setMonthRead(Integer monthRead) {
		this.monthRead = monthRead;
	}
	/**
	 * 获取：月览
	 */
	public Integer getMonthRead() {
		return monthRead;
	}
	/**
	 * 设置：创建时间
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	/**
	 * 获取：创建时间
	 */
	public Date getCreateTime() {
		return createTime;
	}

    public static HdUserModel convert(HdUserEntity entity) {
		if(entity == null) {
			return null;
		}
		HdUserModel model = new HdUserModel();
				model.setHdUserId(entity.getId());
				model.setMobile(entity.getMobile());
				model.setNickname(entity.getNickname());
				model.setAvatar(entity.getAvatar());
				model.setWxAppid(entity.getWxAppid());
				model.setWxOpenid(entity.getWxOpenid());
				model.setTotalRead(entity.getTotalRead());
				model.setWeekRead(entity.getWeekRead());
				model.setMonthRead(entity.getMonthRead());
				model.setCreateTime(entity.getCreateTime());
				
		return model;
	}
	public static List<HdUserModel> convert(List<HdUserEntity> entities){
		if(entities == null || entities.isEmpty()) {
			return null;
		}
		List<HdUserModel> models = new ArrayList<>();
		
		for(HdUserEntity entity:entities) {
			models.add(convert(entity));
		}
		
		return models;
	}
	
	public static HdUserEntity convert(HdUserModel model) {
		if(model == null) {
			return null;
		}
		HdUserEntity entity = new HdUserEntity();
				entity.setId(model.getHdUserId());
				entity.setMobile(model.getMobile());
				entity.setNickname(model.getNickname());
				entity.setAvatar(model.getAvatar());
				entity.setWxAppid(model.getWxAppid());
				entity.setWxOpenid(model.getWxOpenid());
				entity.setTotalRead(model.getTotalRead());
				entity.setWeekRead(model.getWeekRead());
				entity.setMonthRead(model.getMonthRead());
				entity.setCreateTime(model.getCreateTime());
				
		return entity;
	}

}
